package com.smalluz.ad.modules.oe.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

public interface OeApiEnum {

    String getCode();

    String getMsg();

    @AllArgsConstructor
    @Getter
    enum ClueSourceEnum implements OeApiEnum {

        CS0("0", "外部流量" ), CS1("1", "正常投放" ), CS2("2", "外部导入" ), CS3("3", "异常提交" ), CS4("4", "广告预览" ),
        CS5("5", "抖音私信" ), CS6("6", "鲁班线索" ), UNKNOWN("99", "未知渠道" );

        private final String code;

        private final String msg;

        public Integer getIntCode() {
            return Integer.valueOf(code);
        }

        /**
         * 通过code获取描述值
         * @param code
         * @return
         */
        public static String getMsgByCode(String code) {
            return Arrays.stream(ClueSourceEnum.values()).filter(cse -> cse.getCode().equals(code)).findFirst().orElse(ClueSourceEnum.UNKNOWN).getMsg();
        }
    }

    @AllArgsConstructor
    @Getter
    enum AccountRoleEnum implements OeApiEnum {

        ADVERTISER("ADVERTISER", "广告主" ),
        CUSTOMER_ADMIN("CUSTOMER_ADMIN", "协作者授权的纵横组织" ),
        CUSTOMER_OPERATOR("CUSTOMER_OPERATOR", "协作者授权的纵横组织" ),
        AGENT("AGENT", "代理商" ),
        CHILD_AGENT("CHILD_AGENT", "二级代理商" ),
        PLATFORM_ROLE_STAR("PLATFORM_ROLE_STAR", "星图客户" ),
        PLATFORM_ROLE_STAR_AGENT("PLATFORM_ROLE_STAR_AGENT", "星图代理商" ),
        UNKNOWN("99", "未知渠道" );

        private final String code;

        private final String msg;

        /**
         * 通过code获取描述值
         * @param code
         * @return
         */
        public static String getMsgByCode(String code) {
            return Arrays.stream(ClueSourceEnum.values()).filter(cse -> cse.getCode().equals(code)).findFirst().orElse(ClueSourceEnum.UNKNOWN).getMsg();
        }
    }

    @AllArgsConstructor
    @Getter
    enum GroupByEnum implements OeApiEnum {

        STAT_GROUP_BY_FIELD_ID("STAT_GROUP_BY_FIELD_ID", "ID 类型-按照 ID 分组" ),
        STAT_GROUP_BY_ADVERTISER_ID("STAT_GROUP_BY_ADVERTISER_ID", "ID 类型-按照广告主分组" ),
        STAT_GROUP_BY_CAMPAIGN_ID("STAT_GROUP_BY_CAMPAIGN_ID", "ID 类型-按照广告组分组" ),
        STAT_GROUP_BY_AD_ID("STAT_GROUP_BY_AD_ID", "ID 类型-按照广告计划分组" ),
        STAT_GROUP_BY_CREATIVE_ID("STAT_GROUP_BY_CREATIVE_ID", "ID 类型-按照创意分组" ),
        STAT_GROUP_BY_FIELD_STAT_TIME("STAT_GROUP_BY_FIELD_STAT_TIME", "时间类型-按照时间分组" ),
        STAT_GROUP_BY_TIME_MONTH("STAT_GROUP_BY_TIME_MONTH", "时间类型-按照月分组" ),
        STAT_GROUP_BY_TIME_WEEK("STAT_GROUP_BY_TIME_WEEK", "时间类型-按照周分组" ),
        STAT_GROUP_BY_TIME_DAY("STAT_GROUP_BY_TIME_DAY", "时间类型-按照天分组" ),
        STAT_GROUP_BY_TIME_HOUR("STAT_GROUP_BY_TIME_HOUR", "时间类型-按照小时分组" ),
        STAT_GROUP_BY_PRICING("STAT_GROUP_BY_PRICING", "细分基础类型-按照出价类型分组" ),
        STAT_GROUP_BY_IMAGE_MODE("STAT_GROUP_BY_IMAGE_MODE", "细分基础类型-按照素材类型分组" ),
        STAT_GROUP_BY_INVENTORY("STAT_GROUP_BY_INVENTORY", "细分基础类型-按照投放位置分组" ),
        STAT_GROUP_BY_CAMPAIGN_TYPE("STAT_GROUP_BY_CAMPAIGN_TYPE", "细分基础类型-按照广告组类型分组" ),
        STAT_GROUP_BY_CREATIVE_MATERIAL_MODE("STAT_GROUP_BY_CREATIVE_MATERIAL_MODE", "细分基础类型-按照创意类型分组" ),
        STAT_GROUP_BY_EXTERNAL_ACTION("STAT_GROUP_BY_EXTERNAL_ACTION", "细分基础类型-按照转化类型分组" ),
        STAT_GROUP_BY_LANDING_TYPE("STAT_GROUP_BY_LANDING_TYPE", "细分基础类型-按照推广类型分组" ),
        STAT_GROUP_BY_PRICING_CATEGORY("STAT_GROUP_BY_PRICING_CATEGORY", "细分基础类型-按照广告类型分组" ),
        STAT_GROUP_BY_PROVINCE_NAME("STAT_GROUP_BY_PROVINCE_NAME", "细分受众类型-按照省份分组" ),
        STAT_GROUP_BY_CITY_NAME("STAT_GROUP_BY_CITY_NAME", "细分受众类型-按照城市分组" ),
        STAT_GROUP_BY_GENDER("STAT_GROUP_BY_GENDER", "细分受众类型-按照性别分组" ),
        STAT_GROUP_BY_AGE("STAT_GROUP_BY_AGE", "细分受众类型-按照年龄分组" ),
        STAT_GROUP_BY_PLATFORM("STAT_GROUP_BY_PLATFORM", "细分受众类型-按照平台分组" ),
        STAT_GROUP_BY_AC("STAT_GROUP_BY_AC", "细分受众类型-按照网络类型分组" ),
        STAT_GROUP_BY_BIDWORD_ID("STAT_GROUP_BY_BIDWORD_ID", "关键词词类型-按照关键词分组" ),
        STAT_GROUP_BY_QUERY("STAT_GROUP_BY_QUERY", "关键词词类型-按照搜索词分组" ),
        STAT_GROUP_BY_PRODUCT_ID("STAT_GROUP_BY_PRODUCT_ID", "DPA 类型-按照商品 ID 分组" ),
        STAT_GROUP_BY_PRODUCT_PLATFORM_ID("STAT_GROUP_BY_PRODUCT_PLATFORM_ID", "DPA 类型-按照商品库 ID 分组" ),
        STAT_GROUP_BY_MATERIAL_ID("STAT_GROUP_BY_MATERIAL_ID", "素材类型-按照素材 ID 分组" ),
        STAT_GROUP_BY_PLAYABLE_ID("STAT_GROUP_BY_PLAYABLE_ID", "素材类型-按照试玩素材 ID 分组" ),
        UNKNOWN("99", "未知类型" );

        private final String code;

        private final String msg;

        public Integer getIntCode() {
            return Integer.valueOf(code);
        }

        /**
         * 通过code获取描述值
         * @param code
         * @return
         */
        public static String getMsgByCode(String code) {
            return Arrays.stream(ClueSourceEnum.values()).filter(cse -> cse.getCode().equals(code)).findFirst().orElse(ClueSourceEnum.UNKNOWN).getMsg();
        }

    }

}
